from twisted.internet import reactor, task
from src.client import Client


def tick():
    global client
    client.update()

def saveTick():
    global client
    client.autosave()

if __name__ == "__main__":

    #initialise client
    print("initialise client")
    client = Client()

    # start game loop
    loop = task.LoopingCall(tick)
    loop.start(1.0 / 60)

    save = task.LoopingCall(saveTick)
    save.start(100000)
    print("start game loop")
    reactor.run()
